package com.inspection.controller;

import com.inspection.entity.InspectionNoticePoliticsDO;
import com.inspection.entity.InspectionNoticeViolationDO;
import com.inspection.model.dto.InspectPoliticsNoticeDTO;
import com.inspection.model.dto.InspectPoliticsNoticeQueryDTO;
import com.inspection.model.dto.InspectViolationNoticeDTO;
import com.inspection.model.dto.InspectViolationNoticeQueryDTO;
import com.inspection.model.vo.InspectNoticeDefaultVO;
import com.inspection.service.InspectionNoticeService;
import com.inspection.support.Wrapper;
import com.inspection.support.anno.SysLogAnno;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class InspectionNoticeController {

    @Autowired
    private InspectionNoticeService inspectionNoticeService;



    @SysLogAnno(operateCode =110501,operateName = "违规通知通知书：保存")
    @RequestMapping("/inspect/notice/violation/save")
    public Wrapper<String> saveViolationNotice(@RequestBody InspectViolationNoticeDTO save){
        inspectionNoticeService.saveViolationNotice(save);
        return Wrapper.ok("ok");
    }

    @RequestMapping("/inspect/notice/violation/page")
    public Wrapper<Page<InspectionNoticeViolationDO>> pageViolationNotice(@RequestBody InspectViolationNoticeQueryDTO page){

       return  Wrapper.ok(inspectionNoticeService.pageViolationNotice(page));
    }


    @RequestMapping("/inspect/notice/violation/max")
    public Wrapper<InspectNoticeDefaultVO> getMaxViolationNotice(){
        return Wrapper.ok(inspectionNoticeService.getMaxViolationNotice())  ;
      //  return Wrapper.ok(InspectNoticeDefaultVO.builder().word("2020").number("001").build());
    }



    //政治生态
    @SysLogAnno(operateCode =110502,operateName = "政治生态通知书：保存")
    @RequestMapping("/inspect/notice/politics/save")
    public Wrapper<String> savePoliticsNotice(@RequestBody InspectPoliticsNoticeDTO save){
        inspectionNoticeService.savePoliticsNotice(save);
        return Wrapper.ok("ok");
    }

    @RequestMapping("/inspect/notice/politics/page")
    public Wrapper<Page<InspectionNoticePoliticsDO>> pageViolationNotice(@RequestBody InspectPoliticsNoticeQueryDTO page){

        return  Wrapper.ok(inspectionNoticeService.pagePoliticsNotice(page));
    }


    @RequestMapping("/inspect/notice/politics/max")
    public Wrapper<InspectNoticeDefaultVO> getMaxPoliticsNotice(){
        return Wrapper.ok(inspectionNoticeService.getMaxPoliticsNotice())  ;
        //  return Wrapper.ok(InspectNoticeDefaultVO.builder().word("2020").number("001").build());
    }

}
